<?php
/**
 * User: xzq
 * Date: 2018/8/9
 * Time: 10:24
 */

namespace app\wechat\model;

use think\Model;

class Notice extends Model
{
    public function getOne($data){
        $res = self::get(function($query)use($data){
            $query->where($data)->order('id desc');
        });
        return $res ? $res : false;
    }
    /**
     * 通知列表
     * @return bool|false|static[]
     */
    public function getAll($data,$page){
        $limit = 10;
        $res = self::where($data)->field('id,title,content,ctime')->order('id','desc')->paginate($limit,false,['page'=>$page])->toArray();
        return $res ? $res : false ;
    }
}